package immutability;

import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.List;

public class TestImmutableCollection {
    static class Helper {
        int val;

        public Helper(int val) {
            this.val = val;
        }

        @Override
        public String toString() {
            return String.valueOf(val);
        }
    }

    public static void main(String[] args) {
        List<Helper> origin = new ArrayList<>();
        origin.add(new Helper(10));
        origin.add(new Helper(11));
        origin.add(new Helper(13));
        ImmutableList<Helper> ul = ImmutableList.copyOf(origin);
//        ul.get(0).val = 15;
//        origin.add(new Helper(123123));
        origin.set(0, new Helper(123123));
        System.out.println(ul);
        System.out.println(origin);
    }
}
